package com.tanhua.common.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.common.pojo.GenderDistribution;
import com.tanhua.common.pojo.IndustryDistribution;
import com.tanhua.common.pojo.LocalDistribution;
import com.tanhua.common.pojo.UserInfo;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserInfoMapper extends BaseMapper<UserInfo> {

    @Select("select industry AS title,count(industry) AS amount from tb_user_info where created>#{sd} and created<#{ed} group by industry order by amount ASC")
    List<IndustryDistribution> findIndustryDistribution(String sd, String ed);


    @Select("select sex AS title,count(sex) AS amount from tb_user_info where created>#{sd} and created<#{ed} group by sex")
    List<GenderDistribution> findGenderDistribution(String sd, String ed);


    @Select("select city AS title,count(city) AS amount from tb_user_info where created>#{sd} and created<#{ed} group by city")
    List<LocalDistribution> findLocalDistribution(String sd, String ed);

}
